package com.haixiaoke.saas.role.service.impl;

import com.haixiaoke.saas.common.core.domain.entity.SysMenu;
import com.haixiaoke.saas.role.domain.RoleMenu;
import com.haixiaoke.saas.role.mapper.RoleMenuMapper;
import com.haixiaoke.saas.role.service.IRoleMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 企业端角色和菜单关联Service业务层处理
 *
 * @author panda
 * @date 2023-12-29
 */
@Service
public class RoleMenuServiceImpl implements IRoleMenuService {
    @Autowired
    private RoleMenuMapper roleMenuMapper;

    /**
     * 查询企业端角色和菜单关联
     *
     * @param roleId 企业端角色和菜单关联主键
     * @return 企业端角色和菜单关联
     */
    @Override
    public RoleMenu selectBizRoleMenuByRoleId(Long roleId) {
        return roleMenuMapper.selectBizRoleMenuByRoleId(roleId);
    }

    /**
     * 查询企业端角色和菜单关联列表
     *
     * @param roleMenu 企业端角色和菜单关联
     * @return 企业端角色和菜单关联
     */
    @Override
    public List<RoleMenu> selectBizRoleMenuList(RoleMenu roleMenu) {
        return roleMenuMapper.selectBizRoleMenuList(roleMenu);
    }

    /**
     * 新增企业端角色和菜单关联
     *
     * @param roleMenu 企业端角色和菜单关联
     * @return 结果
     */
    @Override
    public int insertBizRoleMenu(RoleMenu roleMenu) {
        return roleMenuMapper.insertBizRoleMenu(roleMenu);
    }

    /**
     * 修改企业端角色和菜单关联
     *
     * @param roleMenu 企业端角色和菜单关联
     * @return 结果
     */
    @Override
    public int updateBizRoleMenu(RoleMenu roleMenu) {
        return roleMenuMapper.updateBizRoleMenu(roleMenu);
    }

    /**
     * 批量删除企业端角色和菜单关联
     *
     * @param roleIds 需要删除的企业端角色和菜单关联主键
     * @return 结果
     */
    @Override
    public int deleteBizRoleMenuByRoleIds(Long[] roleIds) {
        return roleMenuMapper.deleteBizRoleMenuByRoleIds(roleIds);
    }

    /**
     * 删除企业端角色和菜单关联信息
     *
     * @param roleId 企业端角色和菜单关联主键
     * @return 结果
     */
    @Override
    public int deleteBizRoleMenuByRoleId(Long roleId) {
        return roleMenuMapper.deleteBizRoleMenuByRoleId(roleId);
    }

    @Override
    public int checkMenuExistRole(Long menuId) {
        return roleMenuMapper.checkMenuExistRole(menuId);
    }

    @Override
    public int insertBatchRoleMenu(List<RoleMenu> roleDeptList) {
        return roleMenuMapper.insertBatchRoleMenu(roleDeptList);
    }

    @Override
    public List<SysMenu> selectMenuByRoleId(Long roleId) {
        return roleMenuMapper.selectMenuByRoleId(roleId);
    }

    @Override
    public List<Long> selectMenuIdsByRoleId(Long roleId) {
        return roleMenuMapper.selectMenuIdsByRoleId(roleId);
    }

    @Override
    public int deleteBizRoleMenuByMenuId(Long menuId) {
        return roleMenuMapper.deleteBizRoleMenuByMenuId(menuId);
    }
}
